<%-- 
    Document   : AdminDashboard
    Created on : Feb 22, 2014, 10:39:07 AM
    Author     : Mukesh
--%>

<%@page import="java.util.Iterator"%>
<%@page import="java.util.Vector"%>
<%@page import="Course.CourseBean"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%
    try {
        if (session.getAttribute("uid") != null) {
            if (session.getAttribute("Subject").toString().equals("1")) {
%>
<%String to = "", status = "", msg = "";%>
<html>
    <head>
        <title>Ramgovind Automated System</title>

        <link rel="stylesheet" href="/RIT/css/bootstrap.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap-responsive.css">
        <link rel="stylesheet" href="/RIT/css/jquery.fancybox.css">
        <link rel="stylesheet" href="/RIT/css/style.css">
        <link rel="stylesheet" href="/RIT/css/iconfont.css">
        <script src="../../ajax/ajax.js"></script>
        <script>
            function streamName(trg,val){
                document.getElementById(trg).value=val;
            }
        </script>
    </head>
    <body>
        <%@include file="/topheader.html" %>
        <%@include file="/settingheader.html" %>
        <div class="main">
            <div class="container-fluid">

                <%@include file="/Settings/dbsidenav.html" %>
                <div class="content">
                     <%if (session.getAttribute("status") != null) {
                            status = session.getAttribute("status").toString();
                            msg = session.getAttribute("msg").toString();
                    %>
                    <div class="alert alert-success alert-block">
                        <a class="close" data-dismiss="alert" href="#"><img src="/RIT/img/mclose.png"></a>
                        <h4 class="alert-heading"> <%=status%></h4>
                        <%=msg%>

                    </div>
                    <%session.removeAttribute("status");
                            session.removeAttribute("msg");
                        }%>
                    <div class="row-fluid">
                        <div class="span12">
                            <div class="box">
                                <div class="box-head">
                                    <h3>Add Subject</h3>
                                    <a href="/RIT/Settings/Database/Subject.jsp">
                                        <button style="float: right" class="btn btn-success">View Subject</button>
                                    </a>
                                </div>
                                <div class="box-content">
                                    <!---Form Start....-->
                                    <form action="/RIT/AddSubject" method="post" class='validate form-horizontal'>
                                        <div class="control-group">
                                            <label for="sname" class="control-label">Subject Name</label>
                                            <div class="controls">
                                                <input type="text" name="sname" id="sname" class='required' >
                                            </div>
                                        </div>
                                        <div class="control-group">
                                            <label for="course" class="control-label">Course</label>
                                            <div class="controls">
                                                <select name="course" id="course" class='{required:true}'onchange="getStream('stream',this.value)">
                                                    <option value=''>Select Course</option>
                                                    <%
                                                        Vector<Object> list = Course.Query.viewAlldistinct();
                                                        Iterator it = list.iterator();
                                                        while (it.hasNext()) {
                                                            CourseBean cb = (CourseBean) it.next();
                                                    %>
                                                    <option value="<%=cb.getCourseName() %>"><%=cb.getCourseName()%></option>
                                                    <%}%>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="control-group">
                                            <label for="stream" class="control-label">Stream</label>
                                            <div class="controls">
                                                <select name="stream" id="stream" class='{required:true}' onchange="getCoursePeriod(this.value,'subYear'),streamName('streamname',this.options[this.selectedIndex].text)">
                                                    <option value="">Select Stream</option>
                                                </select>
                                                <input type="hidden" value="" id="streamname" name="streamname">
                                            </div>
                                        </div>
                                        <div class="control-group">
                                            <label for="subYear" class="control-label">Semester/Year</label>
                                            <div class="controls">
                                                <select name="subYear" id="subYear" class='{required:true}'>
                                                <option value="">Select Semester/Year</option>   
                                                </select>
                                            </div>
                                        </div>
                                        <div class="control-group">
                                            <label for="marks" class="control-label">Maximum Marks</label>
                                            <div class="controls">
                                                <div class="span3">
                                                    <input type="text" name="marks" id="marks" value="" class='required' onblur="chkMax('minmarks','marks')">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="control-group">
                                            <label for="minmarks" class="control-label">Minimum Marks</label>
                                            <div class="controls">
                                                <div class="span3">
                                                    <input type="text" name="minmarks" id="minmarks" value="" class='required' onblur="chkMax('minmarks','marks')">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="control-group">
                                            <label for="weightege" class="control-label">Weightege(%)</label>
                                            <div class="controls">
                                                <div class="span3">
                                                    <input type="text" name="weightege" id="weightege" value="" class='required'>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="control-group">
                                            <label for="stype" class="control-label">Subject Type</label>
                                            <div class="controls">
                                                <select name="stype" id="stype" class='{required:true}'>
                                                    <option value="-1">Select Type</option>
                                                    <option value="0">Practical</option>
                                                    <option value="1">Theory</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-actions">
                                            <input type="submit" class='btn btn-primary'>
                                        </div>
                                    </form>
                                    <!---Form Ends....-->
                                </div>
                            </div>
                        </div>
                    </div>

                </div>	
            </div>
        </div>

        <script src="/RIT/js/jquery.js"></script>
        <script src="/RIT/js/less.js"></script>
        <script src="/RIT/js/bootstrap.min.js"></script>
        <script src="/RIT/js/jquery.uniform.min.js"></script>
        <script src="/RIT/js/bootstrap.timepicker.js"></script>
        <script src="/RIT/js/bootstrap.datepicker.js"></script>
        <script src="/RIT/js/chosen.jquery.min.js"></script>
        <script src="/RIT/js/jquery.fancybox.js"></script>
        <script src="/RIT/js/plupload/plupload.full.js"></script>
        <script src="/RIT/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
        <script src="/RIT/js/jquery.cleditor.min.js"></script>
        <script src="/RIT/js/jquery.inputmask.min.js"></script>
        <script src="/RIT/js/jquery.tagsinput.min.js"></script>
        <script src="/RIT/js/jquery.mousewheel.js"></script>
        <script src="/RIT/js/jquery.textareaCounter.plugin.js"></script>
        <script src="/RIT/js/ui.spinner.js"></script>
        <script src="/RIT/js/jquery.jgrowl_minimized.js"></script>
        <script src="/RIT/js/jquery.form.js"></script>
        <script src="/RIT/js/jquery.validate.min.js"></script>
        <script src="/RIT/js/bbq.js"></script>
        <script src="/RIT/js/jquery-ui-1.8.22.custom.min.js"></script>
        <script src="/RIT/js/jquery.form.wizard-min.js"></script>
        <script src="/RIT/js/jquery.cookie.js"></script>
        <script src="/RIT/js/jquery.metadata.js"></script>
        <script src="/RIT/js/custom.js"></script><script src="/RIT/js/demo.js"></script>
        <script src="/RIT/js/iconfont.js"></script>
        <script>
            function chkMax(m,ma){
                var min=parseInt(document.getElementById(m).value);
                var max=parseInt(document.getElementById(ma).value);
                if(min>max){
                    alert("check value!");
                    document.getElementById(m).value='';
                    document.getElementById(ma).value='';
                }
            }
        </script>
    </body>
</html>
<%} else {
%>
<script type="text/javascript">
    alert("You Are Not Authorised");
    window.history.back();
</script>
<%             }
        } else {
            request.setAttribute("msg", "You Are Not Authorised! Please Contact to System Administrator!");
            request.setAttribute("value", "0");
            getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
        }
    } catch (Exception e) {
        request.setAttribute("msg", "Please Contact to System Administrator!");
        request.setAttribute("value", "0");
        getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
    }
%>